package com.msf.modules.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.msf.modules.sys.entity.SysUserRole;
import com.msf.modules.sys.mapper.SysUserRoleMapper;
import com.msf.modules.sys.service.ISysUserRoleService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 用户角色表 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-10-09
 */
@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {

    @Override
    public List<String> getRoleIdsByUerId(String userId) {
        return lambdaQuery()
                .eq(SysUserRole::getUserId, userId)
                .list()
                .stream()
                .map(SysUserRole::getRoleId).collect(Collectors.toList());
    }
}
